<template>
    <view class="viewBox">
        <view class="title">
            <view class="head">
                <p style="margin-bottom: 10rpx;">事件名称:</p>
                <p>{{ info.eventName }}</p>
            </view>
            <tui-tag type="danger" padding="10rpx 14rpx" size="26rpx">未完成</tui-tag>
        </view>
        <view class="desc">
            <p>事发地址：{{ info.eventAddr }}</p>
            <p>事发时间：{{ info.eventTime }}</p>
            <p>事件描述：12</p>
            <p>事件级别：{{ info.eventLevel }}</p>
            <p>涉及人数：12</p>
        </view>
        <view class="btn" v-if="userInfo.roleCode == 'tzwy'">
            <button width="70%" @click="open = true, type = 1">流转</button>
            <button width="70%" class="plain">驳回</button>
        </view>
        
        <view class="btn1" v-if="userInfo.roleCode == 'tzwy'">
            <button class="back" width="70%" @click="open = true, type = 2">办结反馈</button>
        </view>

        <tui-modal :show="open" custom>
            <!-- 流转模块 -->
            <view v-if="type == 1 && userInfo.roleCode == 'gdw'" class="tui-modal-custom">
                <view style="padding: 1rem 0; text-align: center; font-size: 30rpx;">任务已成功接收，请及时流转</view>
                <view style="font-size: 30rpx; margin-bottom: 20rpx;">流转至:</view>
                <view class="flex">
                    <multiSelect style="width: 100%;" :list="list" :selVal="selVal" @changee="bb"></multiSelect>
                </view>
                <view class="btn2">
                    <button height="80rpx" :size="28" @click="() => { }">确定</button>
                    <button height="80rpx" :size="28" @click="open = false" class="plain">取消</button>
                </view>
            </view>

            <!-- 办结模块 -->
            <view v-if="type == 2" class="tui-modal-custom">
                <view style="padding: 1rem 0; text-align: center; font-size: 30rpx;">任务已成功接收，请办结反馈</view>
                <view class="flex">
                    <text style="font-size: 30rpx;">情况反馈:</text>
                    <textarea class="textarea" placeholder="请输入具体反馈情况" v-model="mask"></textarea>
                </view>
                <radio-group class="radio" @change="(e) => { dealStatus = evt.detail.value }">
                    <radio value="已办结" :checked="dealStatus === '已办结'" />已办结<text class="left"></text>
                    <radio value="未办结" :checked="dealStatus === '未办结'" />未办结<text class="left"></text>
                    <radio value="需联合办结" :checked="dealStatus === '需联合办结'" />需联合办结
                </radio-group>
                <view class="btn2">
                    <button height="80rpx" :size="28" @click="() => { }">确定</button>
                    <button height="80rpx" :size="28" @click="open = false" class="plain">取消</button>
                </view>
            </view>
        </tui-modal>
    </view>
</template>

<script>
import {
    mapState,
    mapGetters,
    mapMutations
} from 'vuex'
import mClockIn from "@/components/hq-ui/m-clock-in"
import indexConfig from "@/config/index.config.js"
import multiSelect from "./multiSelect"

export default {
    components: {
        mClockIn, multiSelect
    },
    data() {
        return {
            curId: '',
            dealStatus: '已办结',
            mask: '',
            list: [
                { id: 1, adminName: 1212, show: false },
            ],
            selVal: [],
            type: 1, // 办结2 流转1
            open: false,
            info: {},
            // {
            //     "clueId": "1694673286297694210",
            //     "dealStatus": "1",
            //     "dealOpinion": "已办结"
            // }
        }
    },
    computed: {
        ...mapGetters(['tabBar', "hasLogin"]),
        ...mapState(["isUserPhone", 'userInfo']),
    },
    onLoad() {
        this.desc(21);
        this.getSelect()

    },
    onUnload() {

    },
    onShow() {

    },
    methods: {
        //  各单位端 线索反馈 流转
        clueTransfer() {
            this.$apis.clueTransfer({
                "bizId": this.curId, //线索id
                "userIds": this.selVal.map(i=>i.id), //用户id
            }).then(res => {

            })
        },

        // 各单位端 线索反馈 办结
        clueDeal() {
            this.$apis.clueDeal({
                "clueId": this.curId, // 线索id
                "dealStatus": this.dealStatus, // 完结状态
                "dealOpinion": this.mask //情况反馈
            }).then(res => {

            })
        },

        desc(id) {
            this.$apis.listDesc(id).then(res => {
                this.info = res.data;

            })
        },
        getSelect() {
            this.$apis.completionData({
                searchKey: ''
            }).then(res => {
                if(res.data) this.list = res.data;
            })
        },
        bb(data) {
            this.selVal = data.a;
            this.list = data.b;
        },

    },


}
</script>

<style lang="scss">
page {
    background: #fff;
    height: 100%;
}

.flex {
    display: flex;
    align-items: center;
}

.radio {
    margin: 30rpx 0;
}

.left {
    margin-right: 20rpx;
}

.textarea {
    width: 70%;
    border: 1px solid #999;
    height: 6rem;
    padding: 10rpx;
    margin-left: 10rpx;
    border-radius: 10rpx;
}

.viewBox {
    padding: 20rpx;
    position: relative;
    height: 100%;
}

.desc {
    p {
        margin: 40rpx 0;
        color: #999;
    }
}

.btn,
.btn2 {
    display: flex;

    button {
        width: 40%;
        height: 80rpx;
        line-height: 80rpx;
        background: #2a75f3;
        color: #fff;
    }

    .plain {
        background: #fff;
        color: #2a75f3;
        border: 1px solid #2a75f3;
    }
}

.btn {
    position: absolute;
    bottom: 6rem;
    width: 700rpx;
    justify-content: space-around;
}

.btn2 {
    position: relative;
    width: 100%;
    justify-content: space-between;
    margin-top: 4rem;
}

.back {
    background: #2a75f3;
    color: #fff;
    width: 40%;
    height: 70rpx;
    line-height: 70rpx;
}

.title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20rpx 0;
}

.head {
    p {
        font-size: 38rpx;
        font-weight: bold;
    }
}
</style>